package presentationTier;


import core.Genre;
import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;


/**
 * Trida reprezentujici model ComboBoxu
 * Vychazi z ComboBoxModel
 * @author vojta
 */
public class GenreComboBoxModel extends AbstractListModel implements ComboBoxModel{
    private Genre selectedItem = null;
    List<Genre> list;

    public GenreComboBoxModel (List<Genre> list) {
        this.list = list;
    }

    public int getSize() {
        return list.size();
    }

    public Object getElementAt(int index) {
        return list.get(index);
    }

    public void setSelectedItem(Object anItem) {
        selectedItem = (Genre) anItem;
    }

    public Object getSelectedItem() {
        return selectedItem;
    }


}
